<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-cn">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>我的账户</title>
		
		<%@ include file="/WEB-INF/views/modules/marketHeader.jsp"%>
		<link rel="stylesheet" type="text/css" href="${ctxStatic}/IDH/css/myAccount.css" />
		<link rel="stylesheet" type="text/css" href="${ctxStatic}/jq-address/css/select2.css" />
		<link rel="stylesheet" type="text/css" href="${ctxStatic}/jq-address/css/common.css" />
		
	</head>
	<style>
		.form-control {
			background-color: #e2e2e2 !important;
			border-color: #e2e2e2 !important;
			box-shadow: none !important;
		}
		.color-blue {
			color: #34aec8 !important;		
		}
		p.help-block {
			color: #ababab !important;
			font-size: 13px;
		}
		.line-height-26 {
		    line-height: 33px;
		}
		.height-60 {
		    height: 60px;
		}
		input:-webkit-autofill, 
		textarea:-webkit-autofill,
		input[type=text]:focus, input[type=password]:focus, textarea:focus {
		    -webkit-box-shadow: 0 0 0 1000px #e2e2e2 inset !important; 
		}
		@media all and (max-width:640px) {
			.height-60 {
			    height: 80px;
			}
			.control-labal {
				height: 25px;
			}
		}
	</style>
	<body>
	
		
		
		<!--pc content start-->
		<!--模态框 开始-->
		
		<!-- 修改登录密码 开始 -->
		<div class="modal fade" id="passwordModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h4 class="modal-title" id="myModalLabel">修改密码</h4>
					</div>
					<div class="modal-body">
						<div class="col-xs-12">
							<div class="row">
								<form id="modifyForm" class="form-horizontal " action="" method="post">
								    <input type="hidden" name="pmodify" value="true"/>
								    <input type="hidden" name="id" value="${accountInfo.id}"/>
									<div class="form-group margin_bottom">
										<label class="col-lg-3  col-xs-4 control-label">原始密码</label>
										<div class="col-xs-8">
											<input type="password" id="oldPassword" name="passWord" class="form-control" placeholder="原始密码" autofocus autocomplete="off">
										</div>
									</div>
									<div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label">新密码</label>
										<div class="col-xs-8">
											<input type="password" id="newPassword" name="newPassword" class="form-control" placeholder="新密码" autofocus autocomplete="off">
										</div>
									</div>
									<div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label">重复密码</label>
										<div class="col-xs-8">
											<input type="password" id="reNewPassword" name="confirmPassword" class="form-control" placeholder="重复密码" autofocus autocomplete="off">
										</div>
									</div>
									<div class="form-group">
										<label class="col-lg-3 col-xs-4 control-label"></label>
										<div class="col-lg-8 col-xs-12">
											<div class="col-lg-6 col-xs-6">
												<button type="submit" class="btn btn-primary col-xs-12">保存</button>
											</div>
											<div class="col-lg-6 col-xs-6">
												<button type="button"  class="btn btn-default col-xs-12" data-dismiss="modal" onclick="modifyFormReset();">取消</button>
											</div>
										</div>
									</div>
		                        </form>
							</div>
						</div>
                    </div>
                    <div class="modal-footer"></div>
				</div>
			</div>
		</div>
		<!-- 修改登录密码 结束 -->
		<%-- <%@page language="java" pageEncoding="UTF-8" %>
		<div class="alert alert-success pull-right col-xs-4" role="alert" ${message!=null ? '' : 'style="display:none"'}>
			<button type="button" class="close" data-dismiss="alert" style="margin-right:30px;">×</button>
			<strong>${message}!</strong>
		</div> --%>
		<!-- 邮箱验证  开始 -->
		<div class="modal fade" id="emailModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h4 class="modal-title" id="myModalLabel">绑定邮箱</h4>
					</div>
					<div class="modal-body">
						<div class="col-xs-12">
							<div class="row">
								<form id="emailModelSave" class="form-horizontal" action="" method="post">
		                        	<input type="hidden" name="id" value="${user.id}"/>
		                        	<div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label">邮箱</label>
										<div class="col-xs-8">
											<input type="text" id="verifyEmailNum" name="email" class="form-control" placeholder="邮箱" autofocus>
										</div>
									</div>
									<div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label"></label>
										<div class="col-xs-8">
											<div class="input-group">
												<input type="text" class="form-control " name="verificationCode" id="verificationEamilCode" placeholder="验证码" />
												<span class="input-group-btn">
													<a  class="btn btn-primary" href="javascript:void(0);"  id="getEmailCode" onclick="validateCode('email')">
														<i class="ti-plus"></i> 获取验证码
													</a>
												</span>
											</div>
										</div>
									</div>
									<div class="form-group">
										<div class="col-lg-12 col-xs-12">
											<div class="col-lg-6 col-xs-6">
												<button type="button" onclick="saveEmailForm()" class="btn btn-primary col-xs-12">保存</button>
											</div>
											<div class="col-lg-6 col-xs-6">
												<button type="button" class="btn btn-default col-xs-12" data-dismiss="modal">取消</button>
											</div>
										</div>
									</div>
		                        </form>
							</div>
						</div>
                        <div class="modal-footer"></div>
                    </div>
				</div>
			</div>
		</div>
		<!-- 邮箱验证  结束-->
		
		<!-- 手机验证开始 -->
		<div class="modal fade" id="phoneModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h4 class="modal-title" id="myModalLabel">验证手机</h4>
					</div>
					<div class="modal-body">
						<div class="col-xs-12">
							<div class="row">
								<form id="phoneFormSave" class="form-horizontal" method="post">
		                            <input type="hidden" name="id" value="${user.id}"/>
		                            <div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label">手机号</label>
										<div class="col-xs-8">
											<input type="text" id="verifyphoneNum" name="telNum" class="form-control" placeholder="手机号" autofocus>
										</div>
									</div>
									<div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label"></label>
										<div class="col-xs-8">
											<div class="input-group">
												<input type="text" class="form-control " name="verificationCode" id="verificationPhoneCode" placeholder="验证码" />
												<span class="input-group-btn">
													<a  class="btn btn-primary" href="javascript:void(0);"  id="getTelCode" onclick="validateCode('phone')">
														<i class="ti-plus"></i> 获取验证码
													</a>
												</span>
											</div>
										</div>
									</div>
									<div class="form-group">
										<div class="col-lg-12 col-xs-12">
											<div class="col-lg-6 col-xs-6">
												<button type="button" onclick="savePhoneForm()" class="btn btn-primary col-xs-12">保存</button>
											</div>
											<div class="col-lg-6 col-xs-6">
												<button type="button"  class="btn btn-default col-xs-12" data-dismiss="modal">取消</button>
											</div>
										</div>
									</div>
		                        </form>
							</div>
						</div>
                       <div class="modal-footer"></div>
                    </div>
				</div>
			</div>
		</div>
		<!-- 手机验证结束 -->
		<!-- QQ绑定开始 -->
		<div class="modal fade QQmodal" id="QQModal" tabindex="-1" role="dialog" aria-labelledby="QQModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h4 class="modal-title" id="myModalLabel">绑定QQ</h4>
					</div>
					<div class="modal-body">
						<div class="col-xs-12">
							<div class="row">
								<form id="QQFormSave" class="form-horizontal" method="post">
		                            <div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label">QQ号</label>
										<div class="col-xs-8">
											<input type="text" id="QQNum" name="QQNum" class="form-control" placeholder="QQ号" autofocus>
										</div>
									</div>
									<!-- <div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label"></label>
										<div class="col-xs-8">
											<div class="input-group">
												<input type="text" class="form-control " name="QQCode" id="QQCode" placeholder="验证码" />
												<span class="input-group-btn">
													<a  class="btn btn-primary" href="javascript:void(0);" ">
														<i class="ti-plus"></i> 获取验证码
													</a>
												</span>
											</div>
										</div>
									</div> -->
									<div class="form-group">
										<div class="col-lg-12 col-xs-12">
											<div class="col-lg-6 col-xs-6">
												<button type="button" class="btn btn-primary col-xs-12">保存</button>
											</div>
											<div class="col-lg-6 col-xs-6">
												<button type="button"  class="btn btn-default col-xs-12" data-dismiss="modal">取消</button>
											</div>
										</div>
									</div>
		                        </form>
							</div>
						</div>
                       <div class="modal-footer"></div>
                    </div>
				</div>
			</div>
		</div>
		<!-- QQ绑定结束 -->
		<!-- 微信绑定开始 -->
		<div class="modal fade" id="weixinModal" tabindex="-1" role="dialog" aria-labelledby="weixinModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h4 class="modal-title" id="myModalLabel">绑定微信</h4>
					</div>
					<div class="modal-body">
						<div class="col-xs-12">
							<div class="row">
								<form id="QQFormSave" class="form-horizontal" method="post">
		                            <div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label">微信号</label>
										<div class="col-xs-8">
											<input type="text" id="weixinNum" name="weixinNum" class="form-control" placeholder="微信号" autofocus>
										</div>
									</div>
									<!-- <div class="form-group margin_bottom">
										<label class="col-lg-3 col-xs-4 control-label"></label>
										<div class="col-xs-8">
											<div class="input-group">
												<input type="text" class="form-control " name="weixinCode" id="weiixnCode" placeholder="验证码" />
												<span class="input-group-btn">
													<a  class="btn btn-primary" href="javascript:void(0);" ">
														<i class="ti-plus"></i> 获取验证码
													</a>
												</span>
											</div>
										</div>
									</div> -->
									<div class="form-group">
										<div class="col-lg-12 col-xs-12">
											<div class="col-lg-6 col-xs-6">
												<button type="button" class="btn btn-primary col-xs-12">保存</button>
											</div>
											<div class="col-lg-6 col-xs-6">
												<button type="button"  class="btn btn-default col-xs-12" data-dismiss="modal">取消</button>
											</div>
										</div>
									</div>
		                        </form>
							</div>
						</div>
                       <div class="modal-footer"></div>
                    </div>
				</div>
			</div>
		</div>
		<!-- 微信绑定结束 -->
		
		<section class="container content" id="container">
			<div class="col-lg-10 col-xs-12">
				<div class="row">
					<ul class="nav nav-tabs" role="tablist" id="myTab">
						<li role="presentation"  class="active">
							<a href="${ctxf}/userfront/myAccount.html" >我的账户</a>
						</li>
						<li role="presentation">
							<a href="${ctxf}/userfront/toOrder" >我的订单</a>
						</li>
						<li role="presentation">
							<a href="${ctxf}/userfront/toAddress2">收货管理</a>
						</li>
					</ul>
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane active" id="home">
							<div class="col-sm-12 myAccount">
								<div class="row">
									<form id="" name="" method="post" class="form-horizontal myAccountForm" action="">
										<div class="form-group">
											<label class="col-sm-4 control-label">用户名</label>
											<div class="col-sm-4">
												<input type="text" class="form-control" name="userName"  value="${accountInfo.username}" id="userName" placeholder="用户名" />
												<p class="help-block"></p>
											</div>
										</div>
										<div class="form-group height-60">
											<label class="col-sm-4 control-label">登录密码</label>
											<div class="col-sm-4">
												<a class="hidden-xs color-blue line-height-26" href="javascript:void(0);" onclick="changePassword();">修改</a>
												<a class="visible-xs-block color-blue line-height-26" href="javascript:void(0);" onclick="changePassword();">修改</a>
												<p class="help-block">建议定期修改密码</p>
											</div>
										</div>
										<div class="form-group height-60">
											<label class="col-sm-4 control-label">邮箱验证</label>
											<div class="col-sm-4 float_right">
												<c:if test="${accountInfo.email==null||accountInfo.email==''}">
													<a class="hidden-xs color-blue" href="javascript:void(0);" onclick="verifyEmail();">验证</a>
													<a class="visible-xs-block color-blue" href="javascript:void(0);" onclick="verifyEmail();">验证</a>
												</c:if>
											</div>
											<div class="col-sm-4">
												<input type="text" class="form-control" name="userEmail"  value="${accountInfo.email}" id="userEmail" placeholder="" />
												<c:if test="${accountInfo.email!=null&&accountInfo.email!=''}"><p class="help-block">邮箱已验证</p></c:if>
												<c:if test="${accountInfo.email==null||accountInfo.email==''}"><p class="help-block">邮箱未验证</p></c:if>
												<!-- <p class="help-block">邮箱以验证</p> -->
											</div>
										</div>
										<div class="form-group height-60">
											<label class="col-sm-4 control-label">手机验证</label>
											<div class="col-sm-4 float_right">
												<c:if test="${accountInfo.telNum==null}"><p class="help-block"><a href="#" onclick="verifyPhone()" class="color-blue">去绑定</a></p></c:if>
											</div>
											<div class="col-sm-4">
												<input type="text" class="form-control" name="userPhone" value="${accountInfo.telNum}" id="userPhone" placeholder="手机验证" />
												<c:if test="${user.telNum!=null}"><p class="help-block">已绑定手机</p></c:if>
												<c:if test="${accountInfo.telNum==null}"><p class="help-block">还未绑定手机</p></c:if>
											</div>
										</div>
										<div class="form-group margin-bottom">
											<label class="col-sm-4 control-label">第三方登录</label>
											<div class="col-sm-4">
												<p class="margin-bottom hidden-xs color-blue">QQ</p>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-4 control-label"><a class="visible-xs-block color-blue" href="#">QQ</a></label>
											<div class="col-sm-4 float_right">
												<c:if test="${accountInfo.qqNum!=null&&accountInfo.qqNum!=''}"><a href="${ctxf}/qqUnbunding?id=${accountInfo.id}" class="color-blue">解绑</a></c:if>
												<c:if test="${accountInfo.qqNum==null||accountInfo.qqNum==''}">
												<a href="${ctxf}/forQQLogin">
												   <span class="color-blue" id="qqLoginBtn">去绑定</span>
												 </a> 
										      <!--  <script type="text/javascript">
											    QC.Login({
											       btnId:"qqLoginBtn"   //插入按钮的节点id
													});
											  </script> -->
										 <!-- <a href="#" onclick="showQQModal();" class="color-blue">去绑定</a> --></c:if>
											</div>
											<div class="col-sm-4">
											
												<input type="text" class="form-control" name="" value="${qqNickname}" id="userQQ" placeholder="" />
												<c:if test="${accountInfo.qqNum!=null&&accountInfo.qqNum!=''}"><p class="help-block">已绑定  QQ<%-- ：${fn:substring(accountInfo.qqNum,0,3)}****${fn:substring(accountInfo.qqNum,fn:length(accountInfo.qqNum)-2,fn:length(accountInfo.qqNum))} --%></p></c:if>
												<c:if test="${accountInfo.qqNum==null||accountInfo.qqNum==''}"><p class="help-block">还未绑定</p></c:if>
											</div>
										</div>
										<div class="form-group margin-bottom">
											<label class="col-sm-4 control-label"></label>
											<div class="col-sm-4">
												<p class="margin-bottom hidden-xs color-blue">微信</p>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-4 control-label color-blue"><a class="visible-xs-block color-blue" href="#">微信</a></label>
											<div class="col-sm-4 float_right ">
												<c:if test="${accountInfo.wechatNum!=null&&accountInfo.wechatNum!=''}"><a href="${ctxf}/wxUnbundling?id=${accountInfo.id}" class="color-blue">解绑</a></c:if>
												<c:if test="${accountInfo.wechatNum==null||accountInfo.wechatNum==''}"><a href="${ctxf}/weixinForLogin" class="color-blue">去绑定</a></c:if>
											</div>
											<div class="col-sm-4">
												<input type="text" class="form-control" name="userWeixin" value="${wxNickname}" id="userWeixin" placeholder="" />
												<c:if test="${accountInfo.wechatNum!=null&&accountInfo.wechatNum!=''}"><p class="help-block">已绑定 微信</p></c:if>
												<c:if test="${accountInfo.wechatNum==null||accountInfo.wechatNum==''}"><p class="help-block">还未绑定</p></c:if>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</section>

		<!--pc content end-->

		<!--footer start-->
		<%@ include file="/WEB-INF/views/modules/marketFooter.jsp"%>

		<!--footer end-->

	</body>
	<script src="${ctxStatic}/jq-address/js/select2.js" type="text/javascript" charset="utf-8"></script>
	<script src="${ctxStatic}/jq-address/js/location.js" type="text/javascript" charset="utf-8"></script>
	<script src="${ctxStatic}/jq-address/js/area.js" type="text/javascript" charset="utf-8"></script>
	
	<script type="text/javascript">
		$(function() {
			$('#myModal').modal({
				backdrop: 'static',
				keyboard: false,
				show: false
			});
			$('#example').tooltip('show');
			if ("${message}" != "") {
				layer.msg('${message}');
			}
		})
		
		/* pc 添加地址 change 事件 开始 */
		function getPrive(){
			
			$('#province').val($('#select2-chosen-1').html());
			
		}
		function getCity(){
			
			$('#city').val($('#select2-chosen-2').html());
			
		}
		function getTown(){
			
			$('#countyTown').val($('#select2-chosen-3').html());
		
		}
		/* pc 添加地址 change 事件结束*/
		
		/* 移动端添加地址 change 事件 开始 */
		function getPrivePhone(){
			
			$('#province').val($('#select2-chosen-4').html());
			
		}
		function getCityPhone(){
			
			$('#city').val($('#select2-chosen-5').html());
			
		}
		function getTownPhone(){
			
			$('#countyTown').val($('#select2-chosen-6').html());
		
		}

		/* 移动端添加地址 change 事件 结束 */
		
		
		function addressCheck(){
		
			$("#ress").val("false");
			
		}
		
		/* 移动端点击     添加地址  */
		$('.p_new_address_model').click(function() {
			$('.address_form_list').css({"display":"none"});
			$(".p_add_address").css({"display":"block"});
		});
		
		/* 移动端点击     取消添加地址  */
		function addressCancel(){
			$('.address_form_list').css({"display":"block"});
			$(".p_add_address").css({"display":"none"});
		}
		
		
		$(function() {
			$('#myModal').modal({
				backdrop: 'static',
				keyboard: false,
				show: false
			});
		});
		
		$('.new_address_model').click(function() {
			$('#myModal').modal("show");
		})
		
		/* 新增地址事件 */
		function addressSave(){
			if($('#province').val() == "" || $('#province').val() == "省份"){
				toastr.error('请选择省份！',{timeOut: 5000});
				return false;
			}else if($('#city').val() == "" || $('#city').val() == "地级市"){
				toastr.error('请选择市！',{timeOut: 5000});
				return false;
			}else if($('#countyTown').val() == "" || $('#countyTown').val() == "市、县、区"){
				toastr.error('请选择区！',{timeOut: 5000});
				return false;
			}else{
				$("#detail").val($("#p_detail").val());
				$("#df").submit();
			}
		}
		
		
		
		
		/*pc端  修改地址事件 */
		function changeAddress(addressId){
			
			$('#myModal').modal("show");
			
			$.ajax({
				type: "POST",
				url: "${ctxf}/userfront/getAddress?id="+addressId,
				dataType: "json",
				async: true,
				beforeSend: function(XHR) {
					
				},
				success: function(data) {
					debugger
					$("#addId").val(data.id);
					$('#province').val(data.province);
					$('#countyTown').val(data.countyTown)
					$('#city').val(data.city);
					$("#detail").val(data.detail);
					$("#select2-chosen-1").html(data.province);
					$("#select2-chosen-2").html(data.city);
					$("#select2-chosen-3").html(data.countyTown);
				}
			});
		}
		
		/*phone端  修改地址事件 */
		function phoneChangeAddress(addressId){
			
			$('.address_form_list').css({"display":"none"});
			$(".p_add_address").css({"display":"block"});
			
			$.ajax({
				type: "POST",
				url: "${ctxf}/userfront/getAddress?id="+addressId,
				dataType: "json",
				async: true,
				beforeSend: function(XHR) {
					
				},
				success: function(data) {
					$("#addId").val(data.id);
					$('#province').val(data.province);
					$('#countyTown').val(data.countyTown)
					$('#city').val(data.city);
					$("#detail").val(data.detail);
					$("#select2-chosen-4").html(data.province);
					$("#select2-chosen-5").html(data.city);
					$("#select2-chosen-6").html(data.countyTown);
				}
			});
		}
		
		//修改密码
		function modifyPassword(){
			$.ajax({
				type:"POST",
				url:"${ctxf}/account/modifyPassword",
				data:$('#modifyForm').serialize(),
				async:false,
				success:function(data){
					if(data.mresult == "200"){
						toastr.error("新密码输入不能为空！",{timeOut: 5000});
					}else if(data.mresult == "201"){
						toastr.error("确认密码输入不能为空",{timeOut: 5000});
					}else if(data.mresult == "202"){
						toastr.error("二次密码不一致",{timeOut: 5000});
					}else if(data.mresult == "203"){
						toastr.success("密码修改成功",{timeOut: 5000});
						setTimeout(function(){
							window.location.reload();
						},1000);
					}else if(data.mresult == "204"){
						toastr.error("原始密码不正确",{timeOut: 5000});
					}else if(data.mresult == "205"){
						toastr.error("原始密码不能为空",{timeOut: 5000});
					}else if(data.mresult == "206"){
						toastr.error("新密码不能与原始密码相同",{timeOut: 5000});
					}
				}
			});
		}
		
		function validateCode(type){
			debugger
			var url;
			if(type == "phone"){
				var telNum = $("#verifyphoneNum").val();
				if(telNum != "undefined" && telNum!=""&& telNum!=null){
					url="${ctxf}/account/getVerificationCode?telNum="+telNum;
				}else{
					layer.msg("手机号不能为空！");
					return false;
				}
			}else if(type == "email"){
				var email = $("#verifyEmailNum").val();
				
				if(email != "undefined" && email!=""&& email!=null){
					 url="${ctxf}/account/bindMail?email="+email
				}else{
					layer.msg("邮箱不能为空！");
					return false;
				}
			}
			$.ajax({
			     type: 'POST',
			     url: url,
			     success:function(data){
			    	 if(data == "验证码已发送"){
			    		 layer.msg(data);
			    		 var remainTime = 60;
				 		 var intervalId = setInterval(function() {
				 			remainTime--;
				 			if(remainTime > 0) {
				 				$("#getEmailCode").html("重新发送（" + remainTime + "）");
				 				$("#getEmailCode").attr({"disabled":"disabled"});
				 				$("#getTelCode").html("重新发送（" + remainTime + "）");
				 				$("#getTelCode").attr({"disabled":"disabled"});
				 			} else {
				 				clearInterval(intervalId);
				 				$("#getEmailCode").html("获取验证码");
				 				$("#getEmailCode").removeAttr("disabled");
				 				$("#getTelCode").html("获取验证码");
				 				$("#getTelCode").removeAttr("disabled");
				 			}
				 		}, 1000); 
			    	 }else{
			    		 layer.msg(data);
			    	 }
			    	 
			     }
			  
			
			});
		}
		
		/* 修改登录密码 开始 */
		function changePassword(){
			$('#passwordModal').modal("show");
		}
		
		
		/* 修改登录密码 结束 */
		
		/* 验证邮箱 开始 */
		function verifyEmail(){
			$('#emailModal').modal("show");
		}
		function saveEmailForm(){
			$.ajax({
				type:"POST",
				url:"${ctxf}/account/bindMailOrPhone",
				data:$('#emailModelSave').serialize(),
				async:false,
				success:function(data){
					if(data.dataResult == "200"){
						toastr.success("邮箱绑定成功！",{timeOut: 5000});
						window.location.reload();
					}else if(data.dataResult == "201"){
						toastr.error("邮箱输入不能为空",{timeOut: 5000});
					}else if(data.dataResult == "203"){
						toastr.error("没有输入验证码",{timeOut: 5000});
					}else if(data.dataResult == "204"){
						toastr.error("验证码输入不正确",{timeOut: 5000});
					}
				}
			});
		}
		
		/* 验证邮箱 结束 */
		
		
		/* 验证手机开始 */
		function verifyPhone(){
			$('#phoneModal').modal("show");
		}
		function savePhoneForm(){
			$.ajax({
				type:"POST",
				url:"${ctxf}/account/bindMailOrPhone",
				data:$('#phoneFormSave').serialize(),
				async:false,
				success:function(data){
					if(data.dataResult == "200"){
						toastr.success("手机绑定成功！",{timeOut: 5000});
						window.location.reload();
					}else if(data.dataResult == "202"){
						toastr.error("手机输入不能为空",{timeOut: 5000});
					}else if(data.dataResult == "203"){
						toastr.error("没有输入验证码",{timeOut: 5000});
					}else if(data.dataResult == "204"){
						toastr.error("验证码输入不正确",{timeOut: 5000});
					}
				}
			});
		}
		/* 验证手机 结束 */
		
		/* 绑定QQ开始 */
		function showQQModal(){
			$('#QQModal').modal("show");
		}
		/* 绑定QQ结束 */
		/* 绑定微信开始 */
		function showWeixinModal(){
			$('#weixinModal').modal("show");
		}
		/* 绑定微信结束 */
		
		//页面最小高度
		var height = $(window).height() - 241;
		$("#container").css("min-height",height);
		
		$(document).ready(function(){
			$('#modifyForm').bootstrapValidator({  
				 message: 'This value is not valid',
			        feedbackIcons: {
			            valid: '',
			            invalid: '',
			            validating: ''
			        },
			        fields: {   
			            'newPassword': {
			                validators: {
			                    notEmpty: {
			                        message: '密validateCode码不能为空！'
			                    },
			                    stringLength: {
			                        min: 6,
			                        max: 30,
			                        message: '密码长度必须在6到30位！'
			                    },
			                    regexp: {
			                        regexp: /^[A-Za-z0-9]+$/,
			                        message: '密码由数字和26个英文字母组成的字符串'
			                    }
			                }
			            },
			            'confirmPassword': {
			                validators: {
			                	notEmpty: {
			                        message: '密码不能为空！'
			                    },
			                    identical: {
			                        field: 'newPassword',
			                        message: '两次输入密码不一致'
			                    }
			                }
			            },
			        }
			}).on('success.form.bv', function (e) {
				e.preventDefault();
				modifyPassword()
    		})
		})
		
		
		//表单重置
		function modifyFormReset(){
			window.location.reload();
			$('#modifyForm')[0].reset()
		}
		
	</script>

</html>